package lcr;

public class Test0121 {
}

class Solution0121_1 {
    public boolean findTargetIn2DPlants(int[][] plants, int target) {
        int row = plants.length;
        if (row==0) return false;
        int col = plants[0].length;
        if (col==0) return false;

        int i = row-1,j=0;

        while (j<col&&i>=0){
            if (plants[i][j]==target) return true;
            else if (plants[i][j]<target) j++;
            else i--;
        }

        return false;
    }
}